﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TaskSearch.aspx.cs" MasterPageFile="~/Pages/Tesla.Master"
    Inherits="Tesla.Web.Pages.Administrator.TaskSearch" %>
    
   
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">

     <style type="text/css">
        a
        {
            text-decoration: none;
        }
        Tesla_General_Row_Style
        {
            text-decoration :underline;
        }
        .textboxStyle
        {
            margin-left: 0px;
        }
        
        
    </style>
    <script language = "javascript" type="text/javascript">

        var previousText = "";
        function RestrictDescription(txtName) {
            var exp = String.fromCharCode(window.event.keyCode)
            var address = document.getElementById(txtName);

            var r = new RegExp("[-_,/().0-9a-zA-Z \r @ # $ % ^ & { } ; : ? ' \x22 *]", "g");
            if (exp.match(r) == null) {
                window.event.keyCode = 0
                return false;
            }
        }

        function CheckEnteredText(txtName) {
            var patternToCheck = new RegExp("[^-_,/().0-9a-zA-Z \r @ # $ % ^ & { } ; : ? ' \x22 *]", "g");
            var address = document.getElementById(txtName);
            if (patternToCheck.exec(address.value) != null) {
                alert('Invalid characters detected!!');
                document.getElementById(txtName).value = previousText;
                document.getElementById(txtName).focus();
                return false;
            }

        }

        function GetPreviousText(txtName) {
            var getControl = document.getElementById(txtName);
            previousText = getControl.value;
        }
  
    </script>

    <div style="width: 100%; height: 100%; margin: inherit; padding: inherit; border: inherit">
        
        <asp:Panel ID="panel3" runat="server" Width="100%">
            <fieldset>
                <legend class="Tesla_Standard_BigPanelHeading" id="l1" runat="server">Manage Tasks</legend>
                <asp:Panel ID="panel1" runat="server" Width="100%">
                    <fieldset>
                        <legend class="Tesla_Standard_PanelHeading" id="Legend1" runat="server">Search</legend>
                        <table width="100%" style="margin: inherit; padding: inherit; border: inherit">
                            <tr style="height: 5%">
                                <td style="width: 23%" align="right">
                                   <asp:TextBox ID="txtTaskCode" MaxLength="100" runat="server"
                                        Font-Names="Arial" Font-Size="11px" CssClass="textboxStyle"
                            ForeColor="#002664" Width="486px" onkeypress="RestrictDescription(id)" onchange="CheckEnteredText(id)" onpaste="GetPreviousText(id)" ></asp:TextBox>
                                </td>
                                <td style="width: 10%" align="right">
                                    <asp:Button ID="btnSearch" CssClass="Tesla_Standard_Button" runat="server" Text="Search"
                                        Width="75%" OnClick="btnSearch_Click" OnClientClick ="CheckEnteredText(txtTaskCode.id)" />
                                </td>
                                <td style="width: 10%" align="right">
                                    <asp:Button ID="btnDisplayAll" CssClass="Tesla_Standard_Button" runat="server" OnClick="btnDisplayAll_Click"
                                        Width="90%" Text="ShowAll" />
                                </td>
                                <td style="width: 7%" align="right">
                                    <asp:Button ID="btnNew" runat="server" Text="New" Width="75%" CssClass="Tesla_Standard_Button"
                                        OnClick="btnNew_Click" />
                                </td>
                            </tr>
                        </table>
                    </fieldset></asp:Panel>
                <asp:Panel ID="panel2" runat="server" CssClass="Tesla_Standard_PanelHeading" Width="100%">
                    <fieldset>
                        <legend class="Tesla_Standard_PanelHeading" id="Legend2" runat="server">Details</legend>
                        <table width="100%" style="margin: inherit; padding: inherit; border: inherit">
                            <tr style="height: 15%">
                                <td align="center">
                                    <CustomUtil:TeslaDataGrid ID="grdTasks" runat="server" Style="left: 10px;
                                        width: 100%" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
                                        GridLines="None" AllowPaging="true" AllowSorting="True" Font-Size="11px" Font-Strikeout="False"
                                        OnSorting="OnSort" OnRowCreated="OnRowCreated">
                                        <FooterStyle Font-Bold="True" ForeColor="White" />
                                        <RowStyle BackColor="#E3EAEB" HorizontalAlign="Center" />
                                        <Columns>
                                            <asp:TemplateField ItemStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-ForeColor="#00338D"
                                                ItemStyle-Width="30%" ItemStyle-Wrap="true" HeaderText="ID"
                                                SortExpression="TaskID">
                                                <ItemTemplate>
                                                    <asp:HyperLink ForeColor="#002664" ID="PhaseID" NavigateUrl='<%# String.Format("TaskDetails.aspx?ID={0}", DataBinder.Eval(Container.DataItem,"TaskID")) %>'
                                                        Text='<%# Eval("TaskID")%>' runat="server" style= "text-decoration:underline!important" />
                                                </ItemTemplate>
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" HorizontalAlign="Left" Width="30%" Wrap="True" />
                                            </asp:TemplateField>
                                            <asp:BoundField ItemStyle-Font-Bold="false" ItemStyle-Width="10%" DataField="TaskCode"
                                                HeaderText="Task Code" HeaderStyle-ForeColor="#00338D" >
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" Width="10%" />
                                            </asp:BoundField>
                                            <asp:BoundField ItemStyle-Font-Bold="false" ItemStyle-Width="10%" DataField="ParentTaskCode"
                                                HeaderText="Parent Task Code" HeaderStyle-ForeColor="#00338D" >
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" Width="10%" />
                                            </asp:BoundField>
                                            <asp:BoundField ItemStyle-Font-Bold="false" ItemStyle-Width="10%" DataField="TaskDescription"
                                                HeaderText="Task Description" HeaderStyle-ForeColor="#00338D" >
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" Width="10%" />
                                            </asp:BoundField>
                                            <asp:BoundField ItemStyle-Font-Bold="false" ItemStyle-Width="10%" DataField="TaskTypeCode"
                                                HeaderText="Task Type Code" HeaderStyle-ForeColor="#00338D" >
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" Width="10%" />
                                            </asp:BoundField>
                                            <asp:BoundField ItemStyle-Font-Bold="false" ItemStyle-Width="10%" DataField="PhaseCode"
                                                HeaderText="Phase Code" HeaderStyle-ForeColor="#00338D" >
                                                <HeaderStyle ForeColor="#00338D" />
                                                <ItemStyle Font-Bold="False" Width="10%" />
                                            </asp:BoundField>
                                        </Columns>
                                        <%--<PagerStyle BackColor="#666666" ForeColor="#002664" Font-Bold="true" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#98C6F3"  ForeColor="#002664" Font-Bold="true" Font-Size="13px" />
                                    <EditRowStyle HorizontalAlign="Center" BackColor="#FAFBFE" ForeColor="#00338D"  Font-Size="13px"  />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#00338D" Font-Size="13px" BorderColor="#006375" BorderWidth="1px" />--%>
                                        <PagerStyle Font-Bold="true" HorizontalAlign="Center" />
                                        <SelectedRowStyle Font-Bold="True" />
                                        <HeaderStyle CssClass="Tesla_Standard_HeaderStyle" />
                                        <EditRowStyle HorizontalAlign="Center" />
                                        <AlternatingRowStyle BorderColor="#006375" BorderWidth="1px" />
                                    </CustomUtil:TeslaDataGrid>
                                </td>
                            </tr>
                        </table>
                    </fieldset></asp:Panel>
                <table width="100%" style="margin: inherit; padding: inherit;
                    border: inherit">
                    <tr style="width: 10%">
                        <td style="width: 29%">
                            <asp:Label ID="lblPageNo" CssClass="Tesla_Standard_Label" runat="server" Text=""></asp:Label>
                        </td>
                        <td style="width: 7%" align="right">
                            <asp:Button ID="btnFirst" CssClass="Tesla_Standard_Button" runat="server" Text="<<"
                                Visible="true" CommandName="<<" OnClick="btnFirst_Click" />
                        </td>
                        <td style="width: 4%" align="right">
                            <asp:Button ID="btnPrevious" CssClass="Tesla_Standard_Button" runat="server" Text="Previous"
                                Visible="true" OnCommand="ChangePage" Width="90%" CommandName="Previous" />
                        </td>
                        <td style="width: 3%" align="right">
                            <asp:Button ID="btnNext" CssClass="Tesla_Standard_Button" runat="server" Text="Next"
                                Visible="true" OnCommand="ChangePage" CommandName="Next" />
                        </td>
                        <td align="center" style="width: 7%">
                            <asp:DropDownList Width="75%" CssClass="Tesla_Standard_DropDownList" ID="ddlPageNos"
                                runat="server" Visible="true" OnSelectedIndexChanged="ddlPageNos_SelectedIndexChanged"
                                AutoPostBack="true" />
                        </td>
                        <td align="right" style="width: 2%">
                            <asp:Button ID="btnLast" CssClass="Tesla_Standard_Button" runat="server" Text=">>"
                                Visible="true" CommandName=">>" OnClick="btnLast_Click" />
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <%--<telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" DefaultLoadingPanelID="LoadingPanel1">
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnDisplayAll">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="txtEmployeeName" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnSearch">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="txtEmployeeName" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnFirst">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnLast">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnPrevious">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="btnNext">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="ddlPageNos">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdEmployees" LoadingPanelID="LoadingPanel1" />
                                        <telerik:AjaxUpdatedControl ControlID="btnFirst" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnPrevious" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnNext" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="btnLast" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="lblPageNo" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="ddlPageNos" LoadingPanelID="LoadingPanel2" />
                                        <telerik:AjaxUpdatedControl ControlID="hddSearhText" LoadingPanelID="LoadingPanel2" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                        </telerik:RadAjaxManager>--%>
                        <%--<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Transparency="30"  
                            style="filter:alpha(opacity=10);opacity:.10;background: #E7ECF8;position: absolute;" BackColor="AliceBlue">
                            <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/loading_custom.gif" />
                        </telerik:RadAjaxLoadingPanel>
                        <telerik:RadAjaxLoadingPanel ID="LoadingPanel2" runat="server" Transparency="30"
                            BackColor="AliceBlue">
                        </telerik:RadAjaxLoadingPanel>--%>
                    </tr>
                </table>
            </fieldset>
        </asp:Panel>
        <asp:HiddenField ID = "hddSearhText" runat ="server" />
    </div>
</asp:Content>
